﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;
using ThreeByte.ActiveDeck.Content;
using System.Windows.Media;

namespace ThreeByte.ActiveDeck.Converters
{
    public class LayoutOrientationToLengthConverter : IValueConverter
    {
        public double DefaultLength { get; set; }
        public double RotatedLength { get; set; }

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
            
            Orientation o = Orientation.Portrait;
            if(value is Orientation) {
                o = (Orientation)value;
            }

            switch(o){
                case Orientation.LandscapeLeft:
                case Orientation.LandscapeRight: return RotatedLength;
                default: return DefaultLength;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
            throw new Exception("Cannot convert back from OrientationToTransformConverter");
        }
    }
   
}
